#include "GameSceneSea.h"
#include "data/RewardManager.h"


GameSceneSea::GameSceneSea(void)
{
}


GameSceneSea::~GameSceneSea(void)
{
}
bool GameSceneSea::init(){

	CCSpriteBatchNode* spParentNode = CCSpriteBatchNode::create("landres.png");
	addChild(spParentNode);

	float usedWidth = 0.0f;
	for (int i = 0; i < 100; i++)
	{
		RewardSampleVo* sampleVo = RewardManager::shareManager()->randomVo();
		usedWidth += sampleVo->w+64;
		CCObject* obj;
		CCARRAY_FOREACH(sampleVo->AllElements,obj){
			RewardEl* elData = (RewardEl*)obj;
			CCSprite* sprite = CCSprite::createWithSpriteFrameName("star.png");
			sprite->setPosition(ccp(elData->x+usedWidth,elData->y+300));
			spParentNode->addChild(sprite);
		}
	}

	player = CCSprite::createWithSpriteFrameName("apple.png");
	player->setPosition(ccp(100,200));
	addChild(player);
	/*CCFollow* follow = CCFollow::create(player);
	player->runAction(follow);*/

	CCMoveBy* move = CCMoveBy::create(15,ccp(10000,0));
	player->runAction(CCRepeatForever::create(CCSequence::create(move,CCDelayTime::create(1),move->reverse(),CCDelayTime::create(1),NULL)));

	CCMoveBy* thismove = CCMoveBy::create(15,ccp(-10000,0));
	this->runAction(CCRepeatForever::create(CCSequence::create(thismove,CCDelayTime::create(1),thismove->reverse(),CCDelayTime::create(1),NULL)));

	return true;
}
